import React from 'react';
import {BrowserRouter, Route, withRouter, Link} from 'react-router-dom';


function A() {
    return <h1>组件A</h1>
}

function B() {
    return <h1>组件B</h1>
}

function C() {
    return <h1>组件C</h1>
}

function LinkInfo(props) {
    return (
        <div>
            <BrowserRouter>
                <Route path="/a" component={A} exact={true} sensitive={true}/>
                <Route path="/b" component={B} exact={true} sensitive={true}/>
                <Route path="/c" component={C} exact={true} sensitive={true}/>
                <div>
                    <Link to={'/a'}>组件A</Link>
                    <Link style={{margin: 50}} to={{
                        pathname:'/b',
                        search:'?a=5&b=3',
                        hash:'#test',
                        state:'状态数据'
                    }}>组件B</Link>
                    <Link to={'/c'} replace={true} >组件C</Link>
                </div>
            </BrowserRouter>
        </div>
    );
}

export default LinkInfo;